using System;

namespace CSW.Framework.Common.Binding
{
    /// <summary>
    /// ComplexProperty.
    /// </summary>
    public abstract class ComplexProperty
    {
        /// <summary>
        /// Gets or sets the value.
        /// </summary>
        /// <value>The value.</value>
        public abstract object UnsafeValue { get; set; }

        /// <summary>
        /// Gets the type of the value.
        /// </summary>
        /// <value>The type of the value.</value>
        public abstract Type ValueType { get; }

        /// <summary>
        /// Gets a value indicating whether this instance is read only.
        /// </summary>
        /// <value>
        /// 	<c>true</c> if this instance is read only; otherwise, <c>false</c>.
        /// </value>
        public abstract bool IsReadOnly { get; set; }

        /// <summary>
        /// Gets the maximum string length.
        /// </summary>
        /// <value>The maximum string length.</value>
        public abstract int? MaxLength { get; set; }

        /// <summary>
        /// Gets the property name.
        /// </summary>
        /// <value>The property name.</value>
        public abstract string PropertyName { get; }

        /*/// <summary>
        /// Gets or sets a value indicating whether this instance is loaded. 
        /// If set to <c>false</c>, the property getter will request an object refresh on get.
        /// Setting the property's value will set IsLoaded to true and further gets on the property will not trigger a refresh.
        /// </summary>
        /// <value><c>true</c> if this instance is loaded; otherwise, <c>false</c>.</value>
        public abstract bool IsLoaded { get; set; }*/

        /// <summary>
        /// Gets or sets a value indicating whether this instance is a child.
        /// </summary>
        /// <value><c>true</c> if this instance is a child; otherwise, <c>false</c>.</value>
        public abstract bool IsChild { get; }

        /// <summary>
        /// Sets the value to default(T).
        /// </summary>
        public abstract void ClearValue();

        /// <summary>
        /// Not implemented.
        /// </summary>
        [Obsolete("Use .Value on ComplexProperty", true)]
        public static bool operator ==(ComplexProperty c1, ComplexProperty c2)
        {
            throw new Exception("Use .Value on ComplexProperty.");
        }

        /// <summary>
        /// Not implemented.
        /// </summary>
        [Obsolete("Use .Value on ComplexProperty", true)]
        public static bool operator !=(ComplexProperty c1, ComplexProperty c2)
        {
            throw new Exception("Use .Value on ComplexProperty.");
        }

        /// <summary>
        /// Not implemented.
        /// </summary>
        public override bool Equals(object obj)
        {
            return base.Equals(obj);
        }

        /// <summary>
        /// Not implemented.
        /// </summary>
        public override int GetHashCode()
        {
            return base.GetHashCode();
        }
    }
}
